package com.gitee.zhangchenyan.takin.service.common;

import lombok.Data;

@Data
public class ServiceResponse {
    private boolean isSuccess;

    private String errorData;

    private Object context;//返回具体数据


    public static ServiceResponse Success(Object context) {
        ServiceResponse serviceResponse = new ServiceResponse();
        serviceResponse.setSuccess(true);
        serviceResponse.setErrorData("请求成功!");
        serviceResponse.setContext(context);
        return serviceResponse;
    }

    public static ServiceResponse Error(String errorData) {
        ServiceResponse serviceResponse = new ServiceResponse();
        serviceResponse.setSuccess(false);
        serviceResponse.setErrorData(errorData);
        serviceResponse.setContext(null);
        return serviceResponse;
    }
}
